package org.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.domain.Comment;
import org.example.domain.Discussion;

@Mapper
public interface CommentDao extends BaseMapper<Comment> {

    @Delete("delete from comment where discussion_id = #{discussionId}")
    int deleteByDiscussionId(int discussionId);

    @Select("select count(*) from comment where discussion_id = #{discussionId}")
    int getNumberByDiscussionId(Integer discussionId);
}
